package com.ycf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class HelloController  {


    /**
     * 目录：localhost/hello/h1
     * @param model
     * @return
     */
    @RequestMapping("/h1")
    public String hello(Model model) {
        model.addAttribute("msg", "hello SpringMVCAnnotation!");
        return "hello";
    }
     /**
     * 使用restful风格的URL
     * @param model
     * @return
     */
    @RequestMapping("/add/{a}/{b}")
    public String restful(@PathVariable int a, @PathVariable int b, Model model) {

        model.addAttribute("msg", "结果为"+(a+b));
        return "test";
    }
}
